﻿<UserControl x:Class="Notoric.View.Music.CWNotation.Controls.CoreSymbolInserter"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vme="clr-namespace:Notoric.ViewModel.Elements.CWNotation;assembly=ViewModel"
             xmlns:cvr="clr-namespace:Notoric.View.Music.CWNotation.Converters"
             DataContextChanged="UserControl_DataContextChanged"
             MouseDown="UserControl_MouseDown"
             >
    <UserControl.Resources>
        <cvr:VisibilityConverter x:Key="visibilityConverter"/>
    </UserControl.Resources>
    <Canvas>
        <ItemsControl x:Name="PART_Ledgers" ItemsSource="{Binding LedgerLines, Mode=OneWay}" Visibility="{Binding IsSymbolVisible, Mode=OneWay, Converter={StaticResource visibilityConverter}}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas Background="Transparent"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate DataType="{x:Type vme:CoreSymbolInserter}">
                    <Line X1="{Binding X1, Mode=OneWay}" X2="{Binding X2, Mode=OneWay}" Y1="{Binding Y, Mode=OneWay}" Y2="{Binding Y, Mode=OneWay}"
                          Stroke="Gray" StrokeThickness="0.02cm"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        <TextBlock x:Name="PART_InserterSymbol" FontFamily="MusicalSymbols" FontSize="{Binding EffectiveTypeSize, Mode=OneWay}"
                   Canvas.Top="{Binding VerticalPosition, Mode=OneWay}" Canvas.Left="{Binding Position, Mode=OneWay}"
                   Visibility="{Binding IsSymbolVisible, Mode=OneWay, Converter={StaticResource visibilityConverter}}"/>
    </Canvas>
</UserControl>
